COMPILER = g++
CFLAGS = -O3 -Wall -pedantic -I/usr/lib64/glib-2.12/include -I/usr/include/glib-2.12 -I/usr/ -Isrc/
SOURCEFILES = src/datamap.cpp src/keyring.cpp
STATICFLAGS = -static-libgcc -static
TESTFILES = test/datamap_test.hpp test/keyring_test.hpp
TESTFLAGS = -L/home/erkkila2/lib -lcppunit -ldl -pedantic -I/home/erkkila2/include -I/usr/lib64/glib-2.12/include -I/usr/include/glib-2.12 -I/usr/ -Isrc/
.PHONY: all test clean  # Squash directory checks for the usual suspects

all: mergedata

mergedata: $(SOURCEFILES)
	$(COMPILER) $(CFLAGS) src/mergedata.cpp $(SOURCEFILES) -o bin/mergedata

debug: $(SOURCEFILES)
	$(COMPILER) $(CFLAGS) src/mergedata.cpp $(SOURCEFILES) -o bin/mergedata -ggdb

static: $(SOURCEFILES)
	$(COMPILER) $(CFLAGS) src/mergedata.cpp $(STATICFLAGS) $(SOURCEFILES) -o bin/mergedata

test: $(SOURCEFILES) $(TESTFILES)
	rm -f bin/test; $(COMPILER) $(TESTFLAGS) test/run_tests.cpp $(SOURCEFILES) -o bin/test -ggdb; ./bin/test

clean:
	rm -rf bin/mergedata bin/benchmark bin/test bin/*.dSYM/ src/*.o
